package com.zy.edu.controller;


import com.zy.edu.bean.Course;
import com.zy.edu.bean.CourseChapter;
import com.zy.edu.bean.CourseChapterSign;
import com.zy.edu.bean.InputParam;
import com.zy.edu.service.CourseChapterService;
import com.zy.edu.service.CourseService;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author HuangHaiShui
 * @since 2021-07-20
 */
@RestController
@RequestMapping("/courseChapter")
public class CourseChapterController {
    @Resource
    CourseChapterService courseChapterService;

    /**
     * @Author: HuangHaiShui
     * @Description: 数据的新增与修改
     * @Date: 9:17 2021/7/14
     * @param chapter:
     * @return: Map
     **/
    @RequestMapping("/edit")
    public Map edit(@Valid CourseChapter chapter, InputParam inputParam){
        return courseChapterService.saveOrUpdate(chapter,inputParam);
    }
    @RequestMapping("/list")
    public Map list( CourseChapter chapter, InputParam inputParam){

        return courseChapterService.list(chapter, inputParam);
    }


    /**
     * @Author: HuangHaiShui
     * @Description: 删除数据
     * @Date: 9:18 2021/7/14
     * @param chapter:  传入id 字段
     * @return: Map
     **/
    @RequestMapping("/dele")
    public Map dele( CourseChapter chapter){
        return courseChapterService.dele(chapter);
    }
    @RequestMapping("/getById")
    public Map getById(CourseChapter courseChapter, InputParam inputParam){

        return courseChapterService.getById(courseChapter, inputParam);
    }

    //学生课时签到
    @RequestMapping("/sign")
    public Map sign(CourseChapterSign courseChapterSign, InputParam inputParam){

        return courseChapterService.sign( courseChapterSign,inputParam);
    }

}

